<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp_lib/init.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>刷卡任务</title>
<jsp:include page="/WEB-INF/jsp/common/common.jsp" />
<jsp:include page="/WEB-INF/jsp_lib/extjs.jsp" />

<script type="text/javascript">
	var dataStore;

	function to_pos_list(customer_name, bank, customer_card_id) {
		var url = "/cp/xyk/pos/list.htm?customer_card_id=" + customer_card_id;
		window.parent.openTab(customer_name + "-" + bank + "-刷卡记录",
				customer_card_id, url);
	}

	Ext.onReady(function() {

		dataStore = Ext.create('Ext.data.Store', {
			fields : [ 'name', 'mobile', 'kid', 'status', 'created_pos',
					'type', 'money', 'address', 'rate', 'money_remain', 'note',
					'customer_id', 'card_no_pos', 'bank_name', 'money_max',
					'date', 'is_other_card', 'is_past', 'past_cnt',
					'money_remain', 'back_type', 'card_type', 'end_date',
					'bill_type', 'bill_day', 'bill_back_day', 'pwd_query',
					'pwd_pay', 'note' ],
			remoteSort : true,
			autoLoad : true,
			pageSize : 20,
			sorters : {
				property : 't.created',
				direction : 'ASC'
			},
			proxy : {
				type : "ajax",
				url : "list_data.htm",
				reader : {
					type : 'json',
					rootProperty : 'list',
					totalProperty : 'page.rowTotal'
				}
			},
			listeners : {
				'beforeload' : function(store, op, options) {
					var params = searchFormPanel.getForm().getValues();
					Ext.apply(dataStore.proxy.extraParams, params);
				}
			}
		}); //#dataStore

		var searchFormPanel = Ext.create('Ext.form.Panel', {
			frame : true,
			title : "搜索条件",
			style : {
				marginBottom : '5px'
			},
			buttonAlign : "center",
			collapsible : true,
			defaultType : "textfield",
			layout : "column",
			items : [ {
				xtype : "fieldcontainer",
				fieldLabel : "日期",
				labelStyle : "text-align:right;",
				layout : "hbox",
				items : [ {
					xtype : "datefield",
					format : "Y-m-d",

					name : "srh_date",
					id : "srh_date",
					value : "${srh_date}"
				}, {
					xtype : 'label',
					text : '-'
				}, {
					xtype : "datefield",
					format : "Y-m-d",

					name : "srh_date2",
					id : "srh_date2",
					value : "${srh_date2}"
				} ]
			},

			{
				xtype : "container",
				items : [ {
					xtype : "textfield",
					fieldLabel : "卡号",
					labelStyle : "text-align:right;",
					name : "srh_card_no"
				} ]
			}, {
				xtype : "container",
				items : [ {
					xtype : "textfield",
					fieldLabel : "刷卡地点",
					labelStyle : "text-align:right;",
					name : "srh_address"
				} ]
			} ],
			buttons : [ {
				text : "搜索",
				icon : jcapp.getIcon("magnifier.png"),
				handler : function() {
					dataStore.load({
					//params:params()
					});
					dataStore.sync();
				}
			}, {
				text : "重置",
				icon : jcapp.getIcon("arrow_refresh.png"),
				handler : function() {
					this.up('form').getForm().reset();
				}
			} ]
		}); //#searchFormPanel

		var listGridPanel = Ext.create('Ext.grid.Panel', {
			title : '刷卡流水',
			dockedItems : [ {
				xtype : 'pagingtoolbar',
				store : dataStore, // same store GridPanel is using
				dock : 'bottom',
				displayInfo : true
			} ],
			store : dataStore,
			columns : [ {
				text : '卡号',
				dataIndex : 'card_no_pos',
				flex : 1
			}, {
				text : '刷卡时间',
				dataIndex : 'created_pos',
				renderer : function(val) {
					return Ext.util.Format.date(new Date(val), "Y-m-d H:i:s");
				},
				flex : 1
			}, {
				text : '姓名',
				dataIndex : 'name',
				flex : 1
			}, {
				text : '联系方式',
				dataIndex : 'mobile',
				hidden : true,
				flex : 1
			}, {
				text : '银行',
				dataIndex : 'bank_name'
			}, {
				text : '额度',
				dataIndex : 'money_max'
			}, {
				text : '交易地点',
				dataIndex : 'address',
				flex : 1
			}, {
				text : '类型',
				dataIndex : 'type',
				flex : 1
			}, {
				text : '金额',
				dataIndex : 'money'
			}, {
				text : '卡内余额',
				dataIndex : 'money_remain'
			}, {
				text : '机器费率',
				dataIndex : 'rate'
			}, {
				text : '备注',
				dataIndex : 'note',
				flex : 1
			}, {
				text : '账单日',
				dataIndex : 'bill_day'
			}, {
				text : '最后还款日',
				dataIndex : 'bill_back_day'
			} ]
		}); //#listGridPanel

		searchFormPanel.render(Ext.getBody());
		listGridPanel.render(Ext.getBody());

	});
</script>
</head>
<body>

</body>
</html>
